// 根据key合并数组类型
export type MergeArrayByKey<
  Source extends object[],
  Key extends keyof Source[number],
  TargetType
> = Array<{
  [K in keyof Source[number]]: K extends Key ? TargetType : Source[number][K]
}>

// 将联合类型转换为交叉类型
export type UnionToIntersection<U> = (
  U extends any ? (k: U) => void : never
) extends (k: infer I) => void
  ? I
  : never
